package com.asia5b.a5mall.order.adapter

import android.widget.TextView
import com.asia5b.a5bmall.same.databinding.GoodsitemOrderaftersaleBinding
import com.asia5b.a5mall.middleware.model.shop.AbsGoodsModel
import com.asia5b.a5mall.middleware.utils.CurrencyPriceBuilder3
import com.asia5b.a5mall.order.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * Created by zhangyuncai on 2020/1/13.
 */
class OrderAfterSaleGoodsAdapter(list: ArrayList<AbsGoodsModel>) :
        BaseQuickAdapter<AbsGoodsModel, BaseDataBindingHolder<GoodsitemOrderaftersaleBinding>>(R.layout.goodsitem_orderaftersale, list) {
    override fun convert(helper: BaseDataBindingHolder<GoodsitemOrderaftersaleBinding>, item: AbsGoodsModel) {
        val binding = helper.dataBinding!!
        binding.model = item

        val priceText=CurrencyPriceBuilder3().run {
            this.price=item.absGoodsPrice
            this.priceList=item.absGoodsPriceList
            buildPriceText()
        }
        helper.setText(R.id.tv_orderdetail_price, priceText)

        val tv_orderdetail_goodsnum = helper.getView<TextView>(R.id.tv_orderdetail_goodsnum)
        tv_orderdetail_goodsnum.text = "x ${item.absGoodsCurrentBuyNum}"
    }
}